package tech.aistar.day13;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * 本类用来演示: 字符输入流 - 单个字符读取
 *
 * @author: success
 * @date: 2021/3/25 8:56 上午
 */
public class ReaderLineDemo2 {
    public static void main(String[] args) {
        BufferedReader in = null;
        try {
            in = new BufferedReader(new FileReader("src/tech/aistar/day13/FileDemo.java"));

            String line = null;

            while(true){
                line = in.readLine();//一行一行进行读取
                if(line == null)
                    break;
                System.out.println(line);
                Thread.sleep(500L);
            }


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            if(in!=null){
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
